UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zj6vGOlS5dvPRNZpUDzKFNBfCV4KTmzlEqRBFfDT23o='
WHERE
key_id = '0a418dc9624241f46a64ea0705e1ac7436873ed0172f5cdfa4494d0ce572c1a5'
AND (
token = 'zj6vGOlS5dvPRNZpUDzKFNBfCV4KTmzlEqRBFfDT23o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)