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

Query time 0.00036