UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'up5mDdzcjd64Yu2php9pvMYf26XcOf4f52le2+kWoY8='
WHERE
key_id = '017554b1fcc65c1dcbcae0a9854247d89e9f86802d7f736b99daf6987711cbd5'
AND (
token = 'up5mDdzcjd64Yu2php9pvMYf26XcOf4f52le2+kWoY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)