UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PCByUMj5oKitQetuj11QHjon4P0FH2zWjg2mtdM5CQ0='
WHERE
key_id = '289476a450ca8d8e8703763fb585e153153ce4cb98079c42082b811471396df9'
AND (
token = 'PCByUMj5oKitQetuj11QHjon4P0FH2zWjg2mtdM5CQ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)