UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RBT4zTqThSYzj15FdS8iDJPDiaLY2iFQK8nLKY+RfYA='
WHERE
key_id = 'ea37e045b26a65b6d508348d7b2632b95649ee8f9e1267232c5eb567a444db80'
AND (
token = 'RBT4zTqThSYzj15FdS8iDJPDiaLY2iFQK8nLKY+RfYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)