UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3G9+UhYFDxIik+dkBCiFdO3f56DG6SNHwToqJ0mqYzI='
WHERE
key_id = 'f1a8e2e4c5b31822a5338b4040ce019bc94db731c46b1b4354a29f01e173a315'
AND (
token = '3G9+UhYFDxIik+dkBCiFdO3f56DG6SNHwToqJ0mqYzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)