UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ktAk5Kqup7lU5oLJlCDAnFDh/r8Yd3mLhs67hpEkXv4=' 
WHERE 
  key_id = 'd786784ec610887ff23697763396b3c8150ab44f070ef15cf9f8c1cb9785cab6' 
  AND (
    token = 'ktAk5Kqup7lU5oLJlCDAnFDh/r8Yd3mLhs67hpEkXv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031