UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uoznZ0zHl3y0hhDOKCmaWX23W6dV6G7xR1e7n+7YGsE=' 
WHERE 
  key_id = 'be96cf397509eaeaf26b9640d7cb25bd4f8d408c205c5582b221b32af0846cc3' 
  AND (
    token = 'uoznZ0zHl3y0hhDOKCmaWX23W6dV6G7xR1e7n+7YGsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024