UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YhKmp5pJotIe/GgxHNLZJmcqdRW6KREQSgi1425W6lk='
WHERE
key_id = 'd891b89ecff5f55c8a8ed6490ab62eb5485c8d3f0c307f7d62574c76990cbb93'
AND (
token = 'YhKmp5pJotIe/GgxHNLZJmcqdRW6KREQSgi1425W6lk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)