UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MaJQsTlbWE0SemAdIao7va9rd1ZK9KV2U9vsbGekNLY='
WHERE
key_id = 'd38fe87de7f0a78ed95458a15d4cf60a0b9c38393d73fd6fba3816a20dfd1d51'
AND (
token = 'MaJQsTlbWE0SemAdIao7va9rd1ZK9KV2U9vsbGekNLY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)