UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PkbTo6WNAqSTCtgoMrWkj+vYip+TtMLXRlRlH6qoS1A='
WHERE
key_id = '18481576a9a6dab60064e728a8c562034b2c60dd348b79873af7c13d76a6f8d2'
AND (
token = 'PkbTo6WNAqSTCtgoMrWkj+vYip+TtMLXRlRlH6qoS1A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)