UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QajIyTODh+kg/iYcSZEfETRgGpB/AhP3M6y45Bm6jZE='
WHERE
key_id = '3a8aca0b26b6a08f932212195aed0caac66f80399fd56663abb699e0d6effb93'
AND (
token = 'QajIyTODh+kg/iYcSZEfETRgGpB/AhP3M6y45Bm6jZE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)