UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CLxkGo5bY8ntdSnASmSWds9WWmQD1+SdBLMW9aFEKbc='
WHERE
key_id = 'affda5df4fafc49175244335c9fed8e8570a400c45d93f6f3f1f3bd9fa6f8af5'
AND (
token = 'CLxkGo5bY8ntdSnASmSWds9WWmQD1+SdBLMW9aFEKbc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)