UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cpcGsvDYSd7BpjXY0H9IgwBvqV8FzLrgVZh9uHIOgN0=' 
WHERE 
  key_id = '9bcabed29aaf2b1c4f4ad0dbff38381dfacbed999829d080305741195ce78842' 
  AND (
    token = 'cpcGsvDYSd7BpjXY0H9IgwBvqV8FzLrgVZh9uHIOgN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030