UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4dcnmxsxgEdrlrhHE3jC4hojoYaKNfaePwHRBEtlEU0='
WHERE
key_id = 'd639cf24970c7bfa43cf4fffe35ff981fc891eff09331457315e8d626bb0441e'
AND (
token = '4dcnmxsxgEdrlrhHE3jC4hojoYaKNfaePwHRBEtlEU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)