UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O8GAqwwYCmNykACnyr3URwyCWFBA86wyj5A3tOl4Ay0=' 
WHERE 
  key_id = '881f362308af37e195d7cc7cad6984b846dc420f90101fa0228bda763f1eb3ed' 
  AND (
    token = 'O8GAqwwYCmNykACnyr3URwyCWFBA86wyj5A3tOl4Ay0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038