UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pvvIjiwizmufI3CpspDaLcbxb+GFvnS1RZLbZheJCfc=' 
WHERE 
  key_id = 'f9b2097bade6ba9b029ee7d4dbe11fea1de89aa290a48c27d58b05017f0cbb98' 
  AND (
    token = 'pvvIjiwizmufI3CpspDaLcbxb+GFvnS1RZLbZheJCfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017