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