UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tYS1DL6GKQaJ0uKr1gIEE3phcpHCFGIPVq/rl8RJiaI='
WHERE
key_id = 'dd2d9c4a7de1cb29796607403103543f3773f44b0ecc04abb212ff21414d8602'
AND (
token = 'tYS1DL6GKQaJ0uKr1gIEE3phcpHCFGIPVq/rl8RJiaI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)