UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VBB6UwnG1wDpMq3zY027j23GaNTNEuqwgok10okFqwQ=' 
WHERE 
  key_id = 'd2c0658259838df5f9e732473c627633cff51b10be10887b757e1614a561c6dc' 
  AND (
    token = 'VBB6UwnG1wDpMq3zY027j23GaNTNEuqwgok10okFqwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019