UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+k9L3ZwEan9vO0GwVq2sUwbPgSPksCoKEs/f5s6J2c=' 
WHERE 
  key_id = '5b68e7d56c76cff9ab11022a7c6a34ce63180a8f358fd5a0e0afe7643fe64020' 
  AND (
    token = 'P+k9L3ZwEan9vO0GwVq2sUwbPgSPksCoKEs/f5s6J2c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039