UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JKUXBxSBcc+OI15PLU4kluxKyy8EWubgHrZEbKjikjw=' 
WHERE 
  key_id = '42e4ac6c63b817a5f347d4502dbbc3e020fb67ced2f985baefea730ab3ac3a99' 
  AND (
    token = 'JKUXBxSBcc+OI15PLU4kluxKyy8EWubgHrZEbKjikjw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042