UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ahpSOY7gtRFG57gdiE6Pe9Z4RF3Ge0gIS0McRIwLTt4='
WHERE
key_id = '7704a38ea2037aa171bd6619e8d0ed151222bb11b84a22d5db9387077d199fe9'
AND (
token = 'ahpSOY7gtRFG57gdiE6Pe9Z4RF3Ge0gIS0McRIwLTt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)