UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZxbvrwFfcxp2qpI4jzTp9ZI/P+OadDIXtbwX4Dy2ngs='
WHERE
key_id = 'c5a7be786839cb504a47c78e61ceebf4d9c572b460c58605d2839dcfff545d5e'
AND (
token = 'ZxbvrwFfcxp2qpI4jzTp9ZI/P+OadDIXtbwX4Dy2ngs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)