UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qzTx30JOE/byZWeK4zWC1P3WAXPQss2vfS5ISN16tTE='
WHERE
key_id = '38d849b94dff75de6e74cc21dc32d93da3452179a443b40702be0ea9b14ff020'
AND (
token = 'qzTx30JOE/byZWeK4zWC1P3WAXPQss2vfS5ISN16tTE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)