UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6N9DCEVTW5LAMy4aOiLB1joa3yMRvnS/Q5P92MNTnjE='
WHERE
key_id = '65d1bf0847d0f6092648f04c2a9b4adf426c282063f8a38d162b8bd9697a30d8'
AND (
token = '6N9DCEVTW5LAMy4aOiLB1joa3yMRvnS/Q5P92MNTnjE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)