UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PDjd7Q9RyapNTHFSbYa6P0vgMbWDlOvjkL2Mm+o3EpA='
WHERE
key_id = 'b1fa6ee313dbb5ec5c8677a92f947775ef783b47d5a86ddded642a49d44053df'
AND (
token = 'PDjd7Q9RyapNTHFSbYa6P0vgMbWDlOvjkL2Mm+o3EpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)