UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z5X63QQIR/zm+r3RAfL36YCpXcy1FqCLU3A8nVvqwe8='
WHERE
key_id = 'bd5ee431d85e86c1cd0498751ca7b542759044e7dc3772e59019282f441acd46'
AND (
token = 'z5X63QQIR/zm+r3RAfL36YCpXcy1FqCLU3A8nVvqwe8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)